import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Role } from 'src/dataBase/Entities/role.entity';
import { Repository } from 'typeorm';

@Injectable()
export class roleService {
  constructor(
    @InjectRepository(Role)
    private roleRepository: Repository<Role>,
  ) {}

   /**
   * 查询所有数据
   * @returns
   */
   findAll(): Promise<Role[]> {
    return this.roleRepository.find();
  }
  findOne(id: number): Promise<Role | null> {
    return this.roleRepository.findOneBy({ id });
  }

}
